package hczc.longcai.com.hccrowdfunding.home.fourth_mine.activities;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;

import hczc.longcai.com.hccrowdfunding.R;
import hczc.longcai.com.hccrowdfunding.activity.BaseActivity;
import hczc.longcai.com.hccrowdfunding.application.BaseApplication;
import hczc.longcai.com.hccrowdfunding.home.first_index.adapters.IndexHotAdapter;
import hczc.longcai.com.hccrowdfunding.home.first_index.beans.IndexHotRecommend;
import hczc.longcai.com.hccrowdfunding.home.first_index.beans.ProjectInfo;
import hczc.longcai.com.hccrowdfunding.utils.bitmaputils.ImageLoader;

public class MineSponsorActivity extends BaseActivity implements View.OnClickListener {

    private ListView listView;
    private List<ProjectInfo> list;
    private IndexHotAdapter adapter;
    private ImageLoader imageLoader;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mine_sponsor);

        imageLoader = new ImageLoader(this);

        initDatas();
        initViews();
    }

    private void initDatas() {
        list = new ArrayList<>();


    }

    private void initViews() {
        findViewById(R.id.head_back).setOnClickListener(this);
        ((TextView) findViewById(R.id.head_title)).setText("我的发起");

        View view = LayoutInflater.from(this).inflate(R.layout.item_mine_sponsor_footer, null);
        BaseApplication.scaleScreenHelper.loadView(((ViewGroup) view));

        TextView sponsor = (TextView) view.findViewById(R.id.mine_sponsor_sponsor);

        sponsor.setOnClickListener(this);
        listView = ((ListView) findViewById(R.id.mine_mine_sponsor_listview));
        listView.addFooterView(view,null,true);
        adapter = new IndexHotAdapter(this,list,imageLoader);
        listView.setAdapter(adapter);
    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        switch (id){
            case R.id.head_back:
                finish();
                break;
            case R.id.mine_sponsor_sponsor:
//                Toast.makeText(MineSponsorActivity.this,"发起项目",Toast.LENGTH_SHORT).show();
                startActivity(new Intent(MineSponsorActivity.this,SponserActivity.class));
                break;
        }
    }
}
